<template>
    <view style="position: relative;z-index: 0;background: #f6f6f6;height: calc(100% - 120rpx)">
        <view class="search" style="background: #ffffff;display: none;">
            <view>
                <view style="padding:12rpx 12rpx 0 12rpx;">
                    <u-search v-model="searchValue" :clearabled="true" :show-action="false" :height="80"
                        :placeholder="$t('根据关键字进行搜索')" shape="round" @clear="clear" @search="searched"
                        v-if="lang == 'zh'"></u-search>
                    <u-search v-model="searchValue" :clearabled="true" :show-action="false" :height="80"
                        :placeholder="$t('Поиск по ключевым словам')" shape="round" @clear="clear" @search="searched"
                        v-else-if="lang == 'ru'"></u-search>
                </view>
            </view>
        </view>
        <view class="container" style="display: flex;flex-direction: column;height: 100%;">
            <scroll-view class="welltab" scroll-y="true" @touchmove.stop.prevent="() => { }" :enable-flex="true"
                enhanced="true" bounces="false">
                <!-- tab选项 -->
                <view class="flex-around" style="height: 50px;display: none;">
                    <view v-for="(item, index) in topList" :key="index"
                        :class="[item.default ? 'screen-item-avtive' : 'screen-item']" @click="changeTabs(item)"
                        style="width: 33.3%;float: left;text-align: center;font-size: 18px;position: relative;"
                        v-if="lang == 'zh'">
                        <view v-if="lang == 'zh'">
                            {{ item.name }}
                        </view>
                        <view v-else-if="lang == 'ru'">
                            {{ item.name_ru }}
                        </view>
                        <view style="font-size: 10px;position: absolute;right: 10%;top: 30%;" v-if="item.default">
                            ({{ count }})</view>
                    </view>
                    <view v-for="(item, index) in topList" :key="index"
                        :class="[item.default ? 'screen-item-avtive' : 'screen-item']" @click="changeTabs(item)"
                        style="width: 33.3%;float: left;text-align: center;font-size: 12px;position: relative;"
                        v-if="lang == 'ru'">
                        <view v-if="lang == 'zh'">
                            {{ item.name }}
                        </view>
                        <view v-else-if="lang == 'ru'">
                            {{ item.name_ru }}
                        </view>
                        <view style="font-size: 10px;position: absolute;right: 0;top: 30%;" v-if="item.default">
                            ({{ count }})</view>
                    </view>
                </view>
                <!-- 列表 -->
                <view class="zwsp" v-if="goodslist.length == 0">
                    <view style="width: 100%;
				height: 100rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin: 400rpx auto;
				font-size: 35rpx;
				">{{ $t('商品库内暂无商品') }}</view>
                    <view style="
					width: 100%;
					height: 100rpx;
					display: flex;
					align-items: center;
					justify-content: center;
				" @click="handeleGo">
                        <view class="handeleGo_submit">{{ $t('返回') }}</view>
                    </view>
                </view>
                <view v-else v-for="(item, index) in goodslist" class="flex-between acctab u-margin-bottom-20" :key="index">
                    <view class="flex-colomn"
                        style="width: 98%;background: #fff;height: 220rpx;margin: 0 auto;border-radius:18px;">
                        <view style="height: 180rpx;display: flex;" @click="details(item)">
                            <image :src="toImages(item.logo)"
                                style="height: 180rpx; margin-left: 20rpx; width: 180rpx;margin-top: 20rpx;border-radius: 12rpx;float: left;">
                            </image>
                            <view
                                style="float: left;margin-left: 21rpx;margin-top: 29rpx;font-size: 29rpx;font-weight: bolder;width:450rpx;">
                                <view v-if="lang == 'zh'">
                                    {{ item.name }}
                                </view>
                                <view v-else-if="lang == 'ru'">
                                    {{ item.name_ru }}
                                </view>
                                <view v-if="lang == 'zh'">
                                    <view v-if="item.goods_type == 1"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 100rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("中国货物") }}
                                    </view>
                                    <view v-else-if="item.goods_type == 2"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 120rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("俄罗斯货物") }}
                                    </view>
                                    <view v-else-if="item.goods_type == 3"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 160rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("在中俄罗斯货物") }}
                                    </view>
                                    <view v-else-if="item.goods_type == 4"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 160rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("在俄中国货物") }}
                                    </view>
                                    <view>
                                        <view
                                            style="font-size: 20rpx;margin-top: 17rpx;background:red;color: #fff;width: 100rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 12rpx;float: left;">
                                            <view v-if="lang == 'zh'">
                                                {{ item.gfc_name }}
                                            </view>
                                            <view v-else-if="lang == 'ru'">
                                                {{ item.gfc_name_ru }}
                                            </view>
                                        </view>
                                        <view
                                            style="font-size: 20rpx;margin-top: 17rpx;background:#ff9600;color: #fff;width: 120rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 12rpx;float: left;margin-left: 20rpx;">
                                            <view v-if="lang == 'zh'">
                                                {{ item.gfc2_name }}
                                            </view>
                                            <view v-else-if="lang == 'ru'">
                                                {{ item.gfc2_name_ru }}
                                            </view>
                                        </view>
                                    </view>
                                </view>
                                <view v-else-if="lang == 'ru'">
                                    <view v-if="item.goods_type == 1"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 200rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("中国货物") }}
                                    </view>
                                    <view v-else-if="item.goods_type == 2"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 220rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("俄罗斯货物") }}
                                    </view>
                                    <view v-else-if="item.goods_type == 3"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 260rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("在中俄罗斯货物") }}
                                    </view>
                                    <view v-else-if="item.goods_type == 4"
                                        style="font-size: 20rpx;margin-top: 7rpx;background-image:linear-gradient(to right, #0bb8fd, #5845ed);color: #fff;width: 260rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 4rpx;">
                                        {{ $t("在俄中国货物") }}
                                    </view>
                                    <view>
                                        <view
                                            style="font-size: 20rpx;margin-top: 17rpx;background:red;color: #fff;width: 200rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 12rpx;float: left;">
                                            <view v-if="lang == 'zh'">
                                                {{ item.gfc_name }}
                                            </view>
                                            <view v-else-if="lang == 'ru'">
                                                {{ item.gfc_name_ru }}
                                            </view>
                                        </view>
                                        <view
                                            style="font-size: 20rpx;margin-top: 17rpx;background:#ff9600;color: #fff;width: 220rpx;text-align: center;padding: 4rpx 2rpx;border-radius: 12rpx;float: left;margin-left: 20rpx;">
                                            <view v-if="lang == 'zh'">
                                                {{ item.gfc2_name }}
                                            </view>
                                            <view v-else-if="lang == 'ru'">
                                                {{ item.gfc2_name_ru }}
                                            </view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <view style="margin-top: 50rpx;display: none;">
                            <view
                                style="clear: both;margin-left: 21rpx;width: 100rpx;float: left;margin-top: 10rpx;position: relative;"
                                @click="toggleDetails(index)">
                                {{ $t("更多") }}
                                <view v-if="selectedIndex === index"
                                    style="background: #fff;width: 180rpx;height: 140rpx;text-align: center;position: absolute;left:-8%;top: 100%;border-radius: 12rpx;z-index: 111;">
                                    <view style="padding:18rpx 0;font-size: 12px;" @click="detail(item.id)">
                                        {{ $t("编辑商品") }}</view>
                                    <view style="border:2rpx solid #ededed;width: 140rpx;margin: 0 auto;"></view>
                                    <view style="padding:18rpx 0;font-size: 12px;" @click="deleteRelease(item.id)">
                                        {{ $t("删除商品") }}</view>
                                </view>
                            </view>
                            <view v-if="item.status == 1 && lang == 'zh'" @click="delRelease(item.id)"
                                style="font-size: 30rpx;background-image:linear-gradient(to right, #fe4c4c, #e30a1d);color: #fff;text-align: center;border-radius: 24rpx;width: 180rpx;height: 48rpx;line-height: 48rpx;float: left;margin-left: 150rpx;">
                                {{ $t("撤销发布") }}
                            </view>
                            <view v-else-if="item.status == 1 && lang == 'ru'" @click="delRelease(item.id)"
                                style="font-size: 22rpx;background-image:linear-gradient(to right, #fe4c4c, #e30a1d);color: #fff;text-align: center;border-radius: 24rpx;width: 260rpx;height: 48rpx;line-height: 48rpx;float: left;margin-left: 10rpx;">
                                {{ $t("撤销发布") }}
                            </view>
                            <view v-if="item.status == 1 && lang == 'zh'" @click="republishRelease(item.id)"
                                style="font-size: 30rpx;background-image:linear-gradient(to right, #f672d2, #ca72f0);color: #fff;text-align: center;border-radius: 24rpx;margin-left: 20rpx;width: 180rpx;height: 48rpx;line-height: 48rpx;float: left;">
                                {{ $t("再次发布") }}
                            </view>
                            <view v-else-if="item.status == 1 && lang == 'ru'" @click="republishRelease(item.id)"
                                style="font-size: 22rpx;background-image:linear-gradient(to right, #f672d2, #ca72f0);color: #fff;text-align: center;border-radius: 24rpx;margin-left: 20rpx;width: 260rpx;height: 48rpx;line-height: 48rpx;float: left;">
                                {{ $t("再次发布") }}
                            </view>

                            <view v-if="item.status == 0 && lang == 'zh'" @click="xzClick(item.id)"
                                style="font-size: 30rpx;background-image:linear-gradient(to right, #f38d28, #fd664d);color: #fff;width: 100rpx;text-align: center;border-radius: 24rpx;margin-right: 30rpx;width: 180rpx;height: 48rpx;line-height: 48rpx;float: right;">
                                {{ $t("快捷发布") }}
                            </view>
                            <view v-else-if="item.status == 0 && lang == 'ru'" @click="xzClick(item.id)"
                                style="font-size: 22rpx;background-image:linear-gradient(to right, #f38d28, #fd664d);color: #fff;width: 100rpx;text-align: center;border-radius: 24rpx;margin-right: 30rpx;width: 260rpx;height: 48rpx;line-height: 48rpx;float: right;">
                                {{ $t("快捷发布") }}
                            </view>
                        </view>
                    </view>
                </view>
                <view v-if="goodslist.length == 0" style="font-size: 30rpx;margin-top: 30%;text-align: center;">
                    {{ $t("商品库内暂无商品") }}</view>

            </scroll-view>
            <view style="background: #fff;position: fixed;bottom: 5%; display: none; width: 100%;z-index: 1;"
                @click="release">
                <view
                    style="font-size: 30rpx;background-image:linear-gradient(to right, #0167eb, #00baf9);color: #fff;width: 600rpx;text-align: center;border-radius: 36rpx;margin-left: 20rpx;height: 80rpx;margin: 0 auto;line-height: 80rpx;">
                    <view v-if="lang == 'zh'">
                        新增商品
                    </view>
                    <view v-else>
                        Добавить новые товары
                    </view>
                </view>
            </view>
        </view>
        <view style="background: #fff;position: fixed;top: 30%;left:10%;width: 80%;height: 580rpx;z-index: 111;border-radius: 24rpx;text-align: center;
		 " v-if="xzshow && lang == 'zh'">
            <view style="margin-top: 20rpx;font-size: 30rpx;font-weight: bolder;">
                {{ $t("选择发布类型") }}
            </view>
            <view v-for="(item, index) in fblist" :key="index"
                :class="{ 'list-item': true, 'active': selectedIndexs === index }" @click="selectItem(index)">
                {{ item.name }}
            </view>
            <view>
                <view
                    style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 15%;"
                    @click="fblxClick">
                    {{ $t("确认") }}
                </view>
                <view
                    style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 20rpx;"
                    @click="fbqxClick">
                    {{ $t("取消") }}
                </view>
            </view>
        </view>
        <view style="background: #fff;position: fixed;top: 30%;left:10%;width: 80%;height: 580rpx;z-index: 111;border-radius: 24rpx;text-align: center;
		 " v-else-if="xzshow && lang == 'ru'">
            <view style="margin-top: 20rpx;font-size: 30rpx;font-weight: bolder;">
                {{ $t("选择发布类型") }}
            </view>
            <view v-for="(item, index) in fblist" :key="index"
                :class="{ 'list-items': true, 'active': selectedIndexs === index }" @click="selectItem(index)">
                {{ item.name }}
            </view>
            <view>
                <view
                    style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 15%;"
                    @click="fblxClick">
                    {{ $t("确认") }}
                </view>
                <view
                    style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 20rpx;"
                    @click="fbqxClick">
                    {{ $t("取消") }}
                </view>
            </view>
        </view>
        <view
            style="background: #fff;position: fixed;top: 30%;width: 86%;height: 400rpx;z-index: 1111111;margin-left:7%;border-radius: 24rpx;text-align: center;"
            v-if="fblxshow">
            <view style="margin-top: 20rpx;font-size: 30rpx;font-weight: bolder;">
                {{ $t("是否推广置顶发布") }}
            </view>
            <view v-for="(item, index) in zdlist" :key="index"
                :class="{ 'zdlist-item': true, 'activezd': selectedIndexzd === index }" @click="selectItemzd(index)">
                {{ item.name }}
            </view>
            <view>
                <view
                    style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 18%;"
                    @click="quickRelease">
                    {{ $t("确认") }}
                </view>
                <view
                    style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 20rpx;"
                    @click="qxzdClick">
                    {{ $t("取消") }}
                </view>
            </view>
        </view>
        <vipPopup v-if="vipShow" :show="vipShow" @change="clickVipPopup" />
        <view v-if="isModalVisible" class="modal-background" @click="closeModal"></view>
    </view>
</template>

<script>
import {
    createC2CConversation,
    isBase64,
    time
} from "@/common/public";

import {
    IMAGE_URL, IMAGE_PIC
} from "@/config/app";

//列表
import Item from '@/components/detail/GoodsItem2.vue'
//VIP弹窗
import vipPopup from "@/components/vipPopup/index.vue";

export default {
    components: {
        vipPopup,
        Item
    },
    props: {
        title_bool: {
            type: [String, Number, null],
            default: '1'
        }
    },
    data () {
        return {
            phoneHeight: 0,
            isModalVisible: false,
            status: 0, // 状态
            goodslist: [],
            //展示tab款的内容
            topList: [{
                name: '全部',
                default: true,
                // default: false,
                id: 0,
                name_ru: 'Все'
            }, {
                name: '已发布',
                default: false,
                // default: true,
                id: 1,
                name_ru: 'Опубликовано'
            }, {
                name: '待发布',
                default: false,
                // default: true,
                id: 2,
                name_ru: 'Планируется'
            },],
            imgUrl: '',	//图片地址
            contentScrollW: 0, // 导航区宽度
            curIndex: 0, // 当前选中
            scrollLeft: 0, // 横向滚动条位置

            lang: getApp().globalData.lang, // 语言
            type: null, // (列表分类 区别 推广还是竞标   1推广 2竞标 )
            searchValue: "", //搜索内容

            //地区筛选器
            currentCity_name: '地区',//筛选器回显文字
            countryCurrent: null,	//国家id
            provinceCurrnet: null,	//省id
            cityCurrent: null,		//市id

            category: "", 			//类目id
            integral: "", 			//评分
            currentCity: "", 		//选中的城市 用来传参


            area: [],				//国家列表
            province: [],			//省列表
            city: [],				//市列表

            release_goods: [], 		//类目列表 getActionSheetLists 接口 传'release_goods'  返回所有类目列表
            score: [], 				//评分列表 getActionSheetLists 接口 传'score'  返回所有评分列表[100,90][90,80] 作废了

            scoreSortValue: "",		//评分值

            scoreSort: [{			//正序倒序选择排序数组
                label: this.$t('正序'),
                label_ru: this.$t('正序'),
                value: "ASC",
            },
            {
                label: this.$t('倒序'),
                label_ru: this.$t('倒序'),
                value: "DESC",
            }
            ],
            sotreData1: [], 	//列表数据

            //四个分类
            classCurrent: "",	//货物所在地 选中的分类id
            classification: [ 	//分类数组
                {
                    id: 1,
                    title: "中国货物",
                    url: "https://gluz-oss.oss-cn-beijing.aliyuncs.com/uploads/20231101/99b3e2e34d1a000b681e45471d091d73.png"
                },
                {
                    id: 2,
                    title: "俄罗斯货物",
                    url: "https://gluz-oss.oss-cn-beijing.aliyuncs.com/uploads/20231101/99b3e2e34d1a000b681e45471d091d73.png"
                },
                {
                    id: 3,
                    title: "在俄中国货物",
                    url: "https://gluz-oss.oss-cn-beijing.aliyuncs.com/uploads/20231101/f3163bd0f89f8a641b68068176988800.png"
                },
                {
                    id: 4,
                    title: "在中俄罗斯货物",
                    url: "https://gluz-oss.oss-cn-beijing.aliyuncs.com/uploads/20231101/f3163bd0f89f8a641b68068176988800.png"
                },
            ],

            page: 1,			//分页
            datalist: [],		//数据列表

            triggered: false,	//刷新设置

            auth: '',				//用户权限 getUserAuth 这个接口返回

            vipShow: false,			//默认vip弹窗为false
            //后台开关验证 vip权限
            vip: false,

            cardColor: "#fefcf6",	//竞标的卡片背景色
            gdshow: false,
            xzshow: false,
            fblxshow: false,
            count: 0,
            selectedIndex: -1,
            fblist: [
                { name: this.$t('商家推广-货物出售') },
                { name: this.$t('竞标发布-有货求车') },
                { name: this.$t('竞标发布-跨境货代') },
                { name: this.$t('竞标发布-货源信息') }
            ],
            selectedIndexs: 0,// 初始未选中任何项
            zdlist: [
                { name: this.$t('否') },
                { name: this.$t('是') }
            ],
            selectedIndexzd: 0, // 初始未选中任何项
            id: 0,
            is_topping: 1,
        };
    },

    mounted () {
        const info = uni.getSystemInfoSync();
        this.phoneHeight = info.windowHeight;
        console.log(this.phoneHeight)
        if (this.phoneHeight <= 667) {
            this.phoneHeight = 520 + 'px'
        } else {
            this.phoneHeight = 620 + 'px'
        }
        // this.type = parseInt(type)

        this.GoodsList()		//获取货物列表信息
        this.goodsCount()
        // this.getareaOptions()	//获取城市信息
        // this.getAxios()			//统一发送请求 请求类目和评分列表
        this.cardColor = '#FFF'		//推广的卡片背景色
        this.type = 1
        this.imgUrl = IMAGE_PIC			//图片远程域名

        this.getScrollW()				//样式调整

        if (this.title_bool == '1') {
            if (this.lang == 'zh') {
                uni.setNavigationBarTitle({		//自定义标题
                    title: this.$t("商品库")
                })
            } else {
                uni.setNavigationBarTitle({		//自定义标题
                    title: this.$t("Товарный склад")
                })
            }
        }

        this.getUserAuth() 				// 获取用户权限
        this.$u.api.user.appCheck().then(res => {
            this.report = res.report
            this.vip = res.vip
        })
    },
    methods: {
        selectItem (index) {
            this.selectedIndexs = index;
        },
        selectItemzd (index) {
            this.selectedIndexzd = index;
        },
        release () {
            this.$u.route('/pages/user/goods/form')
        },
        toggleDetails (index) {
            if (this.selectedIndex === index) {
                this.selectedIndex = -1; // 再次点击相同项目时隐藏详情
            } else {
                this.selectedIndex = index; // 点击其他项目时显示详情
            }
            // uni.showActionSheet({
            //   itemList: ['选项1', '选项2', '选项3'],
            //   success: function (res) {
            //   },
            //   fail: function (err) {
            //   }
            // });
        },
        xzClick (id) {
            this.id = id
            if (this.xzshow == true) {
                this.xzshow = false
            } else {
                this.xzshow = true
            }
            this.isModalVisible = true
        },
        closeModal (event) {
            // 阻止事件冒泡，防止点击事件穿透到下面的元素
            event.stopPropagation();
            this.isModalVisible = false;
            this.xzshow = false;
            this.fblxshow = false;
        },
        fbqxClick () {
            this.xzshow = false
            this.isModalVisible = false
        },
        fblxClick () {
            if (this.selectedIndexs == 0) {
                this.fblxshow = true
            } else if (this.selectedIndexs == 1) {
                this.$u.route('/pages/release/transport/form?type=2')
            } else if (this.selectedIndexs == 2) {
                this.$u.route('/pages/release/crossborder/form?type=2')
            } else if (this.selectedIndexs == 3) {
                this.$u.route('/pages/release/transport/form?type=2')
            }
            this.xzshow = false
            // if(this.fblxshow==true){
            // 	this.fblxshow=false
            // }else{
            // 	this.fblxshow=true
            // }
        },
        qxzdClick () {
            this.fblxshow = false
            this.isModalVisible = false;
        },
        //点击tab跳转
        changeTabs (item) {
            let obj = this.topList.find(v => v.default)
            if (obj) {
                obj.default = false
                item.default = true
            }
            this.status = item.id
            this.GoodsList()
            this.goodsCount()
        },
        time,
        clickVipPopup () {
            this.vipShow = false		//点击vip弹窗隐藏
        },
        userPage (e) {					//item子组件 点击头像 跳个人主页	
            this.$u.route({
                url: 'pages/user/homePage/homePage',
                params: {
                    id: e.user_id
                }
            })
        },
        //item子组件 点击商品 跳转商品详情
        details (i) {
            // this.$u.route({
            // 	url: "/pages/user/goods/GoodsItem2",
            // 	params: {
            // 		id: i.id,
            // 		type: 1,
            // 		releaseType: 'goods'
            // 	}
            // })
            this.$emit('change', i, 0)
        },
        handeleGo () {
            this.$emit('change', {}, 1)
        },
        detail (id) {
            this.$u.route({
                url: "/pages/user/goods/form",
                params: {
                    id: id,
                }
            })
        },
        // 下拉刷新
        scrolltolower1 (e) {
            //刷新加载圈显示 清空(输入框  货物所在地分类id  选中地区  类目id  评分数据) 刷新商品列表
            this.triggered = true;
            this.searchValue = ""
            this.classCurrent = ""
            this.currentCity = ""
            this.category = ""
            this.score = []
            this.GoodsList(false)
        },
        // 滑轮滚动到顶
        scrolltolowers (e) {
            if (this.datalist.length === 0) {
                // this.$u.toast("没有数据了...")
                return
            }
            this.GoodsList(false)
        },
        // item子组件 点击按钮 触发聊天
        communicates (i) {
            createC2CConversation(i.user.mobile, this)

        },
        // 点击 招标比价  跳入推广发布页面
        fabua (i) {
            uni.navigateTo({
                url: "/pages/release/goods/form"
            })
        },
        // 当选项框被关闭
        closes () {
            this.GoodsList()
        },
        // 用户权限 验证是否是vip
        getUserAuth () {
            const that = this
            that.$u.api.user.getUserAuth().then(res => {
                that.auth = res
                uni.hideLoading()
            })
        },
        //统一发送请求 请求类目和评分列表
        getAxios () {
            this.getActionSheetLists()
            this.getActionSheetLists({
                type: "score"
            })
        },
        // item子组件 点击按钮 （招标比价或竞标） shuxing为1是招标比价或竞标按钮  否则点的是联系按钮
        communicate (i, shuxing, type) {
            if (shuxing == 1) {
                if (type == 1) {
                    this.fabua(i);
                } else {
                    var mobile = uni.getStorageSync('mobile');

                    if (mobile === i.user.mobile) {
                        this.$u.toast(this.$t('不能参与自己'));
                        return false
                    }

                    var that = this
                    that.$u.api.user.order_join_day_auth({
                        lang: that.lang
                    }).then(res => {
                        if (res == 1) {
                            //参与竞标
                            that.$u.route({
                                url: '/pages/order/process/buildOrder',
                                params: {
                                    type: "goods",
                                    release_id: i.id,
                                }
                            })
                        } else {
                            if (that.vip) {
                                that.vipShow = true
                                return
                            } else {
                                uni.showModal({
                                    content: that.$t('您的权限不足哦!请联系工作人员!'),
                                    showCancel: false,
                                    confirmText: that.$t('是'),
                                })
                                return false;
                            }
                        }
                    })
                }
            } else {
                this.communicates(i)
            }
        },
        //获取城市信息
        getareaOptions () {
            this.$u.api.basic.getSelectCityList({ is_port: true }).then(res => {
                this.area = res
            })
        },
        //获取类目信息
        getActionSheetLists (data = {
            type: "release_goods"
        }) {
            this.$u.api.basic.getActionSheetList(data).then(res => {
                if (data.type === "release_goods") {
                    res.forEach(item => {
                        this[data.type].push({
                            label: item.name,
                            label_ru: item.name_ru,
                            value: item.id,
                            image: item.image,
                            image_ru: item.image_ru,
                            current_image: item.current_image,
                            current_image_ru: item.current_image_ru,

                        })
                    })
                    return
                }
                if (data.type === "score") {
                    res.forEach((item, index) => {
                        this.score.push({
                            label: item.join("-"),
                            label_ru: item.join("-"),
                            value: index + 1,
                        })
                    })
                }
            })
        },
        //清除控件
        clear () {
            //获取分类
            this.GoodsList()
        },
        //搜索
        searched (value) {
            //获取分类
            this.GoodsList()
        },
        //获取货物列表信息
        GoodsList (isSearch = true) {
            if (isSearch) {
                this.sotreData1 = []
                this.page = 1
            }
            let data = {
                page: this.page,
                type: this.type,
                searchKey: this.searchValue,
                goods_type: this.classCurrent,
                departure_city: this.currentCity,
                category_id: this.category,
                // score: this.score.filter(item => item.value === this.integral)[0]?.label || "",
                score_sort: this.scoreSortValue,
                status: this.status
            }
            this.$u.api.user.getGoodsList(data).then(res => {
                // if (res.length === 0) {
                // 	this.$u.toast(this.$t('没有数据了'))
                // } else {
                this.sotreData1.push(...res)
                this.goodslist = res
                console.log(res)
                this.triggered = false
                this.page++
                // }
            })
        },

        goodsCount () {
            const that = this
            that.$u.api.user.goodsCount({
                status: that.status
            }).then(res => {
                that.count = res
            })
        },

        quickRelease () {
            if (this.selectedIndexzd == 0) {
                this.is_topping = 1
            } else {
                this.is_topping = 2
            }
            this.$u.api.user.quickRelease({
                id: this.id,
                is_topping: this.is_topping
            }).then(res => {
                uni.redirectTo({
                    url: '/pages/user/goods/goodslist'
                });
            })
            // uni.showModal({
            //   title: '快捷发布',
            //   content: '是否确定提交快捷发布',
            //   success: (res) => {
            // 	  if (res.confirm) {
            // 		 const that = this
            // 		 that.$u.api.user.quickRelease({
            // 		 	id:id
            // 		 }).then(res => {
            // 		 	uni.redirectTo({
            // 		 		url: '/pages/user/goods/goodslist'
            // 		 	  });
            // 		 })
            // 	  } else if (res.cancel) {

            // 	  }
            //   }
            // })
        },


        delRelease (id) {
            uni.showModal({ //提醒用户更新
                title: this.$t('撤销发布'),
                content: this.$t("是否确认撤销商品的'商家推广-货物出售'任务发布"),
                confirmText: this.$t('是'), // 修改确认按钮文字
                cancelText: this.$t('否'),
                success: (res) => {
                    if (res.confirm) {
                        const that = this
                        that.$u.api.user.delRelease({
                            id: id
                        }).then(res => {
                            uni.redirectTo({
                                url: '/pages/user/goods/goodslist'
                            });
                        })
                        // 用户点击了确定，执行相应的逻辑
                    } else if (res.cancel) {
                        // 用户点击了取消，执行相应的逻辑
                    }
                }
            })
        },

        republishRelease (id) {
            uni.showModal({ //提醒用户更新
                title: this.$t('再次发布'),
                content: this.$t("是否确认再次发布商品的'商家推广-货物出售'任务发布"),
                confirmText: this.$t('是'), // 修改确认按钮文字
                cancelText: this.$t('否'),
                success: (res) => {
                    if (res.confirm) {
                        const that = this
                        that.$u.api.user.republishRelease({
                            id: id,
                            lang: this.lang
                        }).then(res => {
                            uni.redirectTo({
                                url: '/pages/user/goods/goodslist'
                            });
                        })
                        // 用户点击了确定，执行相应的逻辑
                    } else if (res.cancel) {
                        // 用户点击了取消，执行相应的逻辑
                    }
                }
            })
        },

        deleteRelease (id) {
            uni.showModal({ //提醒用户更新
                title: this.$t('删除商品'),
                content: this.$t('是否确定提交删除商品'),
                confirmText: this.$t('是'), // 修改确认按钮文字
                cancelText: this.$t('否'),
                success: (res) => {
                    if (res.confirm) {
                        const that = this
                        that.$u.api.user.deleteRelease({
                            id: id
                        }).then(res => {
                            uni.redirectTo({
                                url: '/pages/user/goods/goodslist'
                            });
                        })
                        // 用户点击了确定，执行相应的逻辑
                    } else if (res.cancel) {
                        // 用户点击了取消，执行相应的逻辑
                    }
                }
            })
        },

        //切换货物所在地 分类id
        change (id) {
            this.classCurrent = id
            this.GoodsList()
        },
        //国家点击
        countryClick (id, children) {
            this.province = []
            this.city = []
            this.province = children
            this.countryCurrent = id
        },
        //省点击
        provinceClick (id, children) {
            this.city = []
            this.city = children
            this.provinceCurrnet = id
        },
        //市点击
        cityClick (id, city) {
            this.currentCity = city
            this.currentCity_name = city

            this.cityCurrent = id

            this.GoodsList()
            this.$refs.uDropdown.close();
        },

        //切换选中的评分
        changeScoreSort (value, type) {
            this.GoodsList()
        },
        //选择类目（作废）
        changeCategory (value) {
            this.GoodsList()
        },
        // //选择类目 （新的）
        // changeCategorys(index,category_id) {
        //   this.curIndex = index;
        //   this.category = category_id
        //   // 效果一(当前点击子元素靠左展示)  局限性：子元素宽度相同
        //   this.scrollLeft = index  * this.release_goods[index].width
        //   this.GoodsList()
        // },
        // 获取标题区域宽度，和每个子元素节点的宽度以及元素距离左边栏的距离
        getScrollW () {
            const query = uni.createSelectorQuery().in(this);
            query.select('.content-scroll').boundingClientRect(data => {
                // 拿到 scroll-view 组件宽度
                // this.contentScrollW = data.width
            }).exec();
            query.selectAll('.scroll-item').boundingClientRect(data => {
                let dataLen = data.length;
                for (let i = 0; i < dataLen; i++) {
                    //  scroll-view 子元素组件距离左边栏的距离
                    this.release_goods[i].left = data[i].left;
                    //  scroll-view 子元素组件宽度
                    this.release_goods[i].width = data[i].width
                }
            }).exec()
        }
    },
    computed: {
        isCountry () {
            return (id) => {
                return this.countryCurrent === id ? "#EF692A" : ""
            }
        },
        isProvince () {
            return (id) => {
                return this.provinceCurrnet === id ? "#EF692A" : ""
            }
        },
        classCity () {
            return (id) => {
                return this.cityCurrent === id ? 'currCity' : ''
            }
        },
        toImages () {
            return (src) => {
                try {
                    return isBase64(src) ? src : IMAGE_URL + src
                } catch (e) {

                }
            }
        },
        storeImages () {
            return (sum, images) => images.length > sum ? images.splice(sum) : images
        },
        returnClass () {
            return (id) => {
                return id === this.classCurrent ? "search_class_item currentClass" : "search_class_item"
            }
        },
        scrollerHeight () {
            return {
                height: this.phoneHeight
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.welltab {
    overflow-y: auto;
    height: 100%;
    flex-grow: 1;
    padding: 20rpx 20rpx;
    box-sizing: border-box;
}

.handeleGo_submit {
    width: 200rpx;
    height: 80rpx;
    border-radius: 10rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1rpx solid #AAAAAA;
}

.my-content {
    background-color: $my-bgColorF6F6F6;
    height: 700px;
    overflow-y: scroll;
}

.dropdown_ru {
    height: 90rpx !important;
}

.nav_ru {
    height: 70rpx !important;
}

//搜索框
.search {
    display: flex;
    flex-direction: column;
    // background-color: $my-bgColorFFFFFF;
    margin-bottom: 27.91rpx;

    .search_class {
        display: grid;
        justify-content: space-between;
        grid-template-columns: repeat(2, 315.7rpx);
        margin-top: 15.7rpx;

        .search_class_item {
            margin-top: 15.7rpx;
            height: 99.42rpx;
            border-radius: 20rpx;
            overflow: hidden;
            font-size: 24rpx;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.88);
            line-height: 35rpx;
            display: flex;
            justify-content: flex-end;
            align-items: center;
            padding-right: 15rpx;

            ._item {
                // word-break: break-all;
                width: 184rpx;
                text-align: center;
            }
        }
    }
}

.currentClass {
    border: #FF4D2F solid 1rpx;
}

.bidding_news {
    display: flex;
    justify-content: center;
    margin-bottom: 16rpx;

    .bidding_card {
        width: 692rpx;
        background: $my-bgColorFFFFFF;
        box-shadow: 3rpx 7rpx 3rpx 0rpx rgba(234, 234, 234, 0.5);
        border-radius: 14rpx;
        overflow: hidden;
        padding-bottom: 40rpx;

        .bidding_user {
            display: flex;
            flex-direction: row;
            align-items: center;
            padding: $my-padding-20;

            .bidding_user_text {
                padding-left: 8rpx;
                height: 76rpx;
                padding-top: 14rpx;

            }

            //头像大小
            .bidding_user_image {
                // padding-left: $my-padding-10;
                height: 100rpx;
                width: 100rpx;
                border-radius: 50%;
                border: 1rpx solid orange;
                box-sizing: border-box;
            }

            //用户图标
            .bidding_user_icon {
                padding-left: $my-padding-10;
                height: 35rpx;
                width: 35rpx;
            }

        }

        //商品的简介
        .biddin_synopsis {
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            padding: 0 $my-padding-20 $my-padding-20 $my-padding-20;

            .bidding_synopsis_sel {
                padding: 5.23rpx 0 0 0;
                font-size: $my-font-size21;
                font-weight: 400;
                color: #0B0B0B;
                line-height: 40rpx;

                & text:first-child {}

                & text:last-child {
                    // font-weight: 600;
                }
            }
        }

        //商品图片展示区
        .bidding_image {
            padding: $my-padding-10 0 0 $my-padding-20;

            image {
                width: 229.07rpx;
                height: 225.58rpx;
                margin: 0 30rpx 30rpx 0;
                border-radius: 20rpx;
                box-shadow: 0px 0px 8px 0px #ababab;
            }
        }

        //地址信息
        .bidding_address {
            padding: 13.6rpx $my-padding-20 10rpx $my-padding-20;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            font-size: $my-font-size21;
            font-weight: 400;
            color: #888888;
            line-height: 30rpx;

            .bidding_ares {
                flex: 1;
                display: flex;
                flex-direction: column;
                justify-content: flex-start;

                .bidding_ares1 {
                    word-break: break-all;
                    display: flex;

                    image {
                        width: 24.42rpx;
                        height: 31.4rpx;
                        float: left;
                    }
                }
            }
        }
    }
}

.image_show {
    display: flex;
    padding: 0 20rpx;

    .left {
        width: 52%;
        // margin-right: 20rpx;
    }

    .right {
        width: 46%;

        .top {
            margin-bottom: 20rpx;
        }

        .bottom {
            image {
                width: 270rpx;
                height: 160rpx;
            }

        }
    }
}

.description {
    color: #fff;
    display: flex;
    padding: 0 20rpx 6rpx 20rpx;
    font-size: 28rpx;

    .brand {
        background-color: #00a0e9;
        border-radius: 10rpx;
        padding: 0 20rpx;
        margin: 18rpx 0;
    }

    .weight {
        background-color: #13b5b1;
        border-radius: 10rpx;
        padding: 0 20rpx;
        margin-right: 8rpx;
    }

    .volume {
        background-color: #ef9b17;
        border-radius: 10rpx;
        padding: 0 8rpx;
    }
}

.region {
    height: 500rpx;
    background-color: #FFFFFF;
    display: flex;
    flex-direction: row;

    .country {
        //flex: 1;
    }

    .province {
        height: 100%;
        // flex: 1;
        // overflow: scroll;
    }

    .city {

        display: grid;
        grid-template-columns: repeat(3, 103rpx);
        // grid-template-rows: repeat(20, 70rpx);
        justify-content: space-around;
        overflow: scroll;
        padding-bottom: 20rpx;

        view {
            margin-top: 20rpx;
            width: 100rpx;
            min-height: 50rpx;
            text-wrap: normal;
            background: #EEEEEE;
            border-radius: 14rpx;
            font-size: 21rpx;
            font-weight: 400;
            color: #000000;
            padding: 10rpx;
            line-height: 30rpx;
            display: flex;
            justify-content: center;
            align-items: center;
            word-break: break-word;
        }
    }

}

.currCity {
    background-color: #EF692A !important;
    color: #FFFFFF !important;
}

.bidding_address {
    margin-bottom: 8rpx;
}

.bidding_betwn {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title_red {
    color: #e71818;
    font-weight: bolder;
}

.bottom {
    margin-left: 16rpx;
}

.price_content {
    color: #e71818;

    .price {
        font-size: 50rpx;
    }
}

.nav_z {
    width: 80%;
    height: 50rpx;
    display: flex;
    position: absolute;
    top: 15rpx;
    left: 20%;
}

.tab_nav {
    width: 22%;
    margin-left: 2%;
    line-height: 50rpx;
    text-align: center;
    border-radius: 10rpx;
    color: #606266;
    font-size: 24rpx;
    background-color: rgb(237, 237, 237);
}

.tabnav_ru {
    width: 22%;
    margin-left: 2%;
    line-height: 35rpx;
    text-align: center;
    border-radius: 10rpx;
    color: #606266;
    font-size: 18rpx;
    background-color: rgb(237, 237, 237);
}

.tab_nav_on {
    color: #fff !important;
    background-image: linear-gradient(to right, #ffd234, #ff884d) !important;
}

/*横向滚动操作*/
.lxy-content {
    width: 100%;
    height: 100rpx;
    box-sizing: border-box;
    margin-top: 15rpx;
    margin-left: 0%;

    .content-scroll {
        height: 100rpx;
        white-space: nowrap;

        .scroll-item {
            height: 64rpx;
            line-height: 62rpx;
            background: #FFFFFF;
            border-radius: 10rpx;
            display: inline-block;
            text-align: center;
            font-size: 28rpx;
            font-family: PingFang SC;
            font-weight: 400;
            color: #666666;
            margin-right: 28rpx;
            padding-right: 0 24rpx;

            &.active {
                color: #FFFFFF;
            }
        }

        .scroll-item:last-child {
            margin-right: 28rpx;
        }
    }
}

.release_goods_img {
    width: 170rpx;
    height: 100rpx;
}

/* 点击文字的颜色 */
.screen-item-avtive {
    position: relative;
    font-size: 28rpx;
    font-family: PingFang SC, PingFang SC;
    font-weight: bold;
    color: #428AF6;
    letter-spacing: 2rpx;
    padding: 24rpx 0;
}

/* 本来展示的颜色 */
.screen-item {
    font-size: 28rpx;
    font-family: PingFang SC, PingFang SC;
    color: #333;
    letter-spacing: 2rpx;
    padding: 24rpx 0;
}

/* 点击的底部线条颜色 */
.screen-item-avtive::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    height: 4rpx;
    background-color: #428AF6;
    width: 50%;
    transform: translateX(-50%);
    border-radius: 4rpx;

    // transition: all .5s linear;
    animation: change 1s linear;
}

/* 底部变化 */
@keyframes change {
    0% {
        width: 50%;
    }

    50% {
        width: 100%;
    }

    100% {
        width: 50%;
    }
}

uni-page-body {
    background: #f6f6f6;
}

.list-item {
    padding: 23rpx 18rpx;
    font-size: 28rpx;
    // background: #018ff2;
    width: 50%;
    color: #000;
    border-radius: 12rpx;
    margin: 0 auto;
    margin-top: 3%;
}

.list-items {
    padding: 23rpx 18rpx;
    font-size: 28rpx;
    // background: #018ff2;
    width: 90%;
    color: #000;
    border-radius: 12rpx;
    margin: 0 auto;
    margin-top: 3%;
}

.active {
    background-color: #018ff2;
    /* 选中的颜色 */
    color: #fff;
}

.zdlist-item {
    padding: 23rpx 18rpx;
    font-size: 28rpx;
    width: 50%;
    color: #000;
    border-radius: 12rpx;
    margin: 0 auto;
    margin-top: 5%;
}

.activezd {
    background-color: #018ff2;
    /* 选中的颜色 */
    color: #fff;
}

.modal-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2;
}
</style>